package com.qx.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qx.mapper.GoodsMapper;
import com.qx.po.Goods;
import com.qx.service.IGoodsService;

@Service("iGoodsService")
public class GoodsServiceImpl implements IGoodsService {
	
@Autowired
	private GoodsMapper goodsMapper; //通过@Autowired向spring容器注入Mapper
	public void setGoodsMapper(GoodsMapper goodsMapper) {
		this.goodsMapper = goodsMapper;
	}
	@Override
	public Goods selectGoodsBygno(String gno) throws Exception {
		Goods good = goodsMapper.selectGoodsBygno(gno);
        return good;
	}
	@Override
    //查询所有 Goods 信息
    public List<Goods> selectGoodsAll() throws Exception {
    	List<Goods> good = goodsMapper.selectGoodsAll();
        return good;
    }
	@Override
    //向 Goods 表插入一条数据
    public void insertGoods(Goods goods) throws Exception {
    	goodsMapper.insertGoods(goods);
    }
	@Override   
    //根据 GNO 修改 Goods 表数据
    public void updateGoodsBygno(Goods goods) throws Exception {
    	goodsMapper.updateGoodsBygno(goods);
    }
	@Override   
    //根据 GNO 删除 Goods 表数据
    public void deleteGoodsBygno(String gno) throws Exception {
    	goodsMapper.deleteGoodsBygno(gno);
    }

}
